/*   1:    */ package com.rinsi.app.azsb.azzl.scs.scb;
/*   2:    */ 
/*   3:    */ import com.rinsi.core.CoreCache;
/*   4:    */ import com.rinsi.core.service.CoreSimpleService;
/*   5:    */ import com.rinsi.util.AssertUtil;
/*   6:    */ import com.rinsi.util.FileUtil;
/*   7:    */ import com.rinsi.util.ListUtil;
/*   8:    */ import com.rinsi.util.MapUtil;
/*   9:    */ import com.rinsi.util.SpringContextUtil;
/*  10:    */ import java.util.ArrayList;
/*  11:    */ import java.util.Iterator;
/*  12:    */ import java.util.List;
/*  13:    */ import java.util.Map;
/*  14:    */ import org.mybatis.spring.SqlSessionTemplate;
/*  15:    */ import org.springframework.stereotype.Service;
/*  16:    */ 
/*  17:    */ @Service
/*  18:    */ public class ScbService
/*  19:    */   extends CoreSimpleService
/*  20:    */ {
/*  21:    */   public void afterIndex(Map<String, Object> model, Map<String, Object> rMap)
/*  22:    */   {
/*  23: 25 */     Map<String, Object> params = getParams(model);
/*  24:    */     
/*  25: 27 */     Map<String, Object> config = getConfig(model);
/*  26:    */     
/*  27: 29 */     List<Map<String, Object>> modules = CoreCache.getCacheList(MapUtil.getString(params, "UID"), "modules");
/*  28:    */     
/*  29: 31 */     List<Map<String, Object>> sub_rights = ListUtil.subList(modules, "MODULE_NO_PRE='500005'");
/*  30:    */     
/*  31: 33 */     rMap.put("azsbxx", getSqlSessionTemplate().selectOne("azsb.get", params));
/*  32:    */     
/*  33: 35 */     Object isgz = getSqlSessionTemplate().selectOne(namespace(config) + ".isgz", params);
/*  34:    */     
/*  35: 37 */     rMap.put("userxx", CoreCache.getCacheMap(MapUtil.getString(params, "UID"), "user"));
/*  36:    */     
/*  37: 39 */     model.put("sub_rights", ListUtil.listToMap(sub_rights, "MODULE_TYPE"));
/*  38:    */     try
/*  39:    */     {
/*  40: 43 */       List<Map<String, Object>> list = getSqlSessionTemplate().selectList(namespace(config) + ".list", params);
/*  41:    */       
/*  42: 45 */       List<Map<String, Object>> datas = new ArrayList();
/*  43: 47 */       for (Iterator<Map<String, Object>> iterator = list.iterator(); iterator.hasNext();)
/*  44:    */       {
/*  45: 49 */         Map<String, Object> map = (Map)iterator.next();
/*  46:    */         
/*  47: 51 */         String mod = MapUtil.getString((Map)model.get("module"), "MODULE_NO");
/*  48:    */         
/*  49: 53 */         String filepath = (String)((Map)SpringContextUtil.getBean("config")).get("filepath") + mod + "/";
/*  50:    */         
/*  51: 55 */         filepath = filepath + map.get("AQSCXKZSCS_ID");
/*  52:    */         
/*  53: 57 */         List<Map<String, Object>> files = FileUtil.getFileList(filepath);
/*  54: 59 */         if (files.size() > 0) {
/*  55: 61 */           map.put("FJSL_MC", "已上传");
/*  56:    */         } else {
/*  57: 65 */           map.put("FJSL_MC", "未上传");
/*  58:    */         }
/*  59: 69 */         datas.add(map);
/*  60:    */       }
/*  61: 73 */       if (isgz != null) {
/*  62: 75 */         isgz = Boolean.valueOf(false);
/*  63:    */       } else {
/*  64: 79 */         isgz = Boolean.valueOf(true);
/*  65:    */       }
/*  66: 83 */       rMap.put("ISGZ", isgz);
/*  67:    */       
/*  68: 85 */       rMap.put("datas", datas);
/*  69:    */       
/*  70: 87 */       rMap.put("success", Boolean.valueOf(true));
/*  71:    */     }
/*  72:    */     catch (Exception e)
/*  73:    */     {
/*  74: 91 */       rMap.put("success", Boolean.valueOf(false));
/*  75: 93 */       if (MapUtil.getBoolean(rMap, "shoeExMessage").booleanValue()) {
/*  76: 95 */         rMap.put("message", e.getMessage());
/*  77:    */       } else {
/*  78: 99 */         rMap.put("message", "展示数据列表出错！请稍后重试，或联系系统管理员！");
/*  79:    */       }
/*  80:102 */       rMap.put("ex", e.getMessage());
/*  81:    */       
/*  82:104 */       e.printStackTrace();
/*  83:    */     }
/*  84:    */   }
/*  85:    */   
/*  86:    */   public Map<String, Object> list(Map<String, Object> model)
/*  87:    */   {
/*  88:114 */     Map<String, Object> params = getParams(model);
/*  89:    */     
/*  90:116 */     Map<String, Object> config = getConfig(model);
/*  91:    */     
/*  92:118 */     Map<String, Object> rMap = getRMap();
/*  93:    */     try
/*  94:    */     {
/*  95:122 */       beforeList(model);
/*  96:    */       
/*  97:124 */       Integer page = MapUtil.getInteger(params, "page");
/*  98:    */       
/*  99:126 */       Integer rows = MapUtil.getInteger(params, "rows");
/* 100:    */       
/* 101:128 */       List<Map<String, Object>> list = getSqlSessionTemplate().selectList(namespace(config) + ".list", params);
/* 102:    */       
/* 103:130 */       List<Map<String, Object>> datas = new ArrayList();
/* 104:132 */       for (Iterator<Map<String, Object>> iterator = list.iterator(); iterator.hasNext();)
/* 105:    */       {
/* 106:134 */         Map<String, Object> map = (Map)iterator.next();
/* 107:    */         
/* 108:136 */         String mod = MapUtil.getString((Map)model.get("module"), "MODULE_NO");
/* 109:    */         
/* 110:138 */         String filepath = (String)((Map)SpringContextUtil.getBean("config")).get("filepath") + mod + "/";
/* 111:    */         
/* 112:140 */         filepath = filepath + map.get("AQSCXKZSCS_ID");
/* 113:    */         
/* 114:142 */         List<Map<String, Object>> files = FileUtil.getFileList(filepath);
/* 115:144 */         if (files.size() > 0) {
/* 116:146 */           map.put("FJSL_MC", "已上传");
/* 117:    */         } else {
/* 118:150 */           map.put("FJSL_MC", "未上传");
/* 119:    */         }
/* 120:154 */         datas.add(map);
/* 121:    */       }
/* 122:158 */       if ((MapUtil.getInteger(config, "module.page") != null) && (MapUtil.getInteger(config, "module.page").intValue() == 1)) {
/* 123:160 */         if (AssertUtil.isCollectionNotEmpty(datas))
/* 124:    */         {
/* 125:162 */           rMap.put("total", Integer.valueOf(datas.size()));
/* 126:    */           
/* 127:164 */           Integer begin = Integer.valueOf((page.intValue() - 1) * rows.intValue());
/* 128:    */           
/* 129:166 */           Integer end = Integer.valueOf(page.intValue() * rows.intValue());
/* 130:168 */           if (end.intValue() > datas.size()) {
/* 131:170 */             end = Integer.valueOf(datas.size());
/* 132:    */           }
/* 133:173 */           datas = datas.subList(begin.intValue(), end.intValue());
/* 134:    */         }
/* 135:    */         else
/* 136:    */         {
/* 137:177 */           rMap.put("total", Integer.valueOf(0));
/* 138:    */         }
/* 139:    */       }
/* 140:181 */       rMap.put("datas", datas);
/* 141:    */     }
/* 142:    */     catch (Exception ex)
/* 143:    */     {
/* 144:185 */       rMap.put("success", Boolean.valueOf(false));
/* 145:187 */       if (MapUtil.getBoolean(rMap, "shoeExMessage").booleanValue()) {
/* 146:189 */         rMap.put("message", ex.getMessage());
/* 147:    */       } else {
/* 148:193 */         rMap.put("message", "展示数据列表出错！请稍后重试，或联系系统管理员！");
/* 149:    */       }
/* 150:196 */       rMap.put("ex", ex.getMessage());
/* 151:    */       
/* 152:198 */       ex.printStackTrace();
/* 153:    */     }
/* 154:201 */     afterList(model, rMap);
/* 155:    */     
/* 156:203 */     return rMap;
/* 157:    */   }
/* 158:    */   
/* 159:    */   public Map<String, Object> updateXkzscs(Map<String, Object> model)
/* 160:    */   {
/* 161:208 */     Map<String, Object> params = getParams(model);
/* 162:    */     
/* 163:210 */     Map<String, Object> config = getConfig(model);
/* 164:    */     
/* 165:212 */     Map<String, Object> rMap = getRMap();
/* 166:    */     try
/* 167:    */     {
/* 168:216 */       getSqlSessionTemplate().update(namespace(config) + ".update", params);
/* 169:    */       
/* 170:218 */       rMap.put("success", Boolean.valueOf(true));
/* 171:    */     }
/* 172:    */     catch (Exception ex)
/* 173:    */     {
/* 174:222 */       rMap.put("success", Boolean.valueOf(false));
/* 175:224 */       if (MapUtil.getBoolean(rMap, "shoeExMessage").booleanValue()) {
/* 176:226 */         rMap.put("message", ex.getMessage());
/* 177:    */       } else {
/* 178:230 */         rMap.put("message", "保存数据出错！请稍后重试，或联系系统管理员！");
/* 179:    */       }
/* 180:233 */       rMap.put("ex", ex.getMessage());
/* 181:    */       
/* 182:235 */       ex.printStackTrace();
/* 183:    */     }
/* 184:238 */     if (!AssertUtil.isStringNotEmpty(params.get(config.get("module.idCol")))) {
/* 185:240 */       afterInsert(model, rMap);
/* 186:    */     } else {
/* 187:244 */       afeterUpdate(model, rMap);
/* 188:    */     }
/* 189:247 */     return rMap;
/* 190:    */   }
/* 191:    */   
/* 192:    */   public Map<String, Object> updateSFSC(Map<String, Object> model)
/* 193:    */   {
/* 194:252 */     Map<String, Object> params = getParams(model);
/* 195:    */     
/* 196:254 */     Map<String, Object> config = getConfig(model);
/* 197:    */     
/* 198:256 */     Map<String, Object> rMap = getRMap();
/* 199:    */     try
/* 200:    */     {
/* 201:260 */       getSqlSessionTemplate().update(namespace(config) + ".updateSFSC", params);
/* 202:    */       
/* 203:262 */       String mod = MapUtil.getString((Map)model.get("module"), "MODULE_NO");
/* 204:    */       
/* 205:264 */       String filepath = (String)((Map)SpringContextUtil.getBean("config")).get("filepath") + mod + "/";
/* 206:    */       
/* 207:266 */       filepath = filepath + params.get("AQSCXKZSCS_ID");
/* 208:    */       
/* 209:268 */       List<Map<String, Object>> files = FileUtil.getFileList(filepath);
/* 210:270 */       if (files.size() > 0) {
/* 211:272 */         FileUtil.deleteDirectory(filepath);
/* 212:    */       }
/* 213:276 */       rMap.put("success", Boolean.valueOf(true));
/* 214:    */     }
/* 215:    */     catch (Exception ex)
/* 216:    */     {
/* 217:280 */       rMap.put("success", Boolean.valueOf(false));
/* 218:282 */       if (MapUtil.getBoolean(rMap, "shoeExMessage").booleanValue()) {
/* 219:284 */         rMap.put("message", ex.getMessage());
/* 220:    */       } else {
/* 221:288 */         rMap.put("message", "修改数据出错！请稍后重试，或联系系统管理员！");
/* 222:    */       }
/* 223:291 */       rMap.put("ex", ex.getMessage());
/* 224:    */       
/* 225:293 */       ex.printStackTrace();
/* 226:    */     }
/* 227:296 */     if (!AssertUtil.isStringNotEmpty(params.get(config.get("module.idCol")))) {
/* 228:298 */       afterInsert(model, rMap);
/* 229:    */     } else {
/* 230:302 */       afeterUpdate(model, rMap);
/* 231:    */     }
/* 232:305 */     return rMap;
/* 233:    */   }
/* 234:    */   
/* 235:    */   public Map<String, Object> updateSczt(String id, Integer sczt)
/* 236:    */   {
/* 237:310 */     Map<String, Object> rMap = getRMap();
/* 238:    */     
/* 239:312 */     Map<String, Object> params = getRMap();
/* 240:    */     
/* 241:314 */     params.put("AQSCXKZSCS_ID", id);
/* 242:    */     
/* 243:316 */     params.put("AQSCXKZSCS_SCZT", sczt);
/* 244:    */     try
/* 245:    */     {
/* 246:320 */       getSqlSessionTemplate().update("azsb/azzl/scs/scb.updateSczt", params);
/* 247:    */       
/* 248:322 */       rMap.put("success", Boolean.valueOf(true));
/* 249:    */     }
/* 250:    */     catch (Exception ex)
/* 251:    */     {
/* 252:326 */       rMap.put("success", Boolean.valueOf(false));
/* 253:    */     }
/* 254:330 */     return rMap;
/* 255:    */   }
/* 256:    */ }


/* Location:           D:\Users\Desktop\shanxi\项目\sxazmis\WEB-INF\classes\
 * Qualified Name:     com.rinsi.app.azsb.azzl.scs.scb.ScbService
 * JD-Core Version:    0.7.0.1
 */